find_package(Qt5Xdg REQUIRED)

set(statusNotifierHostTest_SRCS
    status-notifier-model.cpp status-notifier-model.h
    item-icon-provider.cpp item-icon-provider.h
    icon-item.cpp icon-item.h
    tray-app.cpp tray-app.h
#    setting.cpp setting.h
        main.cpp )
set(QRC_FILES qml.qrc)

find_package(PkgConfig REQUIRED)
set(UKUI_SNI_EXTERNAL_LIBS "")
set(UKUI_SNI_PC_PKGS gsettings-qt)
foreach(external_lib IN ITEMS ${UKUI_SNI_PC_PKGS})
        pkg_check_modules(${external_lib} REQUIRED ${external_lib})
        if(${${external_lib}_FOUND})
                include_directories(${${external_lib}_INCLUDE_DIRS})
                link_directories(${${external_lib}_LIBRARY_DIRS})
                list(APPEND UKUI_SNI_EXTERNAL_LIBS ${${external_lib}_LIBRARIES})
        endif()
endforeach()
message(STATUS "External libraries found: ${UKUI_SNI_EXTERNAL_LIBS}")

include_directories(${CMAKE_SOURCE_DIR}/status-notifier-host)
message(${CMAKE_SOURCE_DIR})

if(COMMAND qt_add_dbus_adaptor)
    qt_add_dbus_adaptor(statusNotifierHostTest_SRCS dbus/org.kde.TrayAppStatusNotifierItem.xml tray-app.h TrayApp)
else()
    qt5_add_dbus_adaptor(statusNotifierHostTest_SRCS dbus/org.kde.TrayAppStatusNotifierItem.xml tray-app.h TrayApp)
endif()

qt_add_dbus_interface(statusNotifierHostTest_SRCS ../dbus/org.kde.StatusNotifierWatcher.xml statusnotifierwatcher_interface)

add_executable(ukui-sni-test ${statusNotifierHostTest_SRCS} ${QRC_FILES})

target_link_libraries(ukui-sni-test PRIVATE
        Qt${QT_MAJOR_VERSION}::Core
        Qt${QT_MAJOR_VERSION}::Gui
        Qt${QT_VERSION_MAJOR}::Widgets
        Qt${QT_MAJOR_VERSION}::Quick
        Qt5Xdg
        ukui-sni-host
        )
